<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html">

    <p:panelGrid id="pgrid2" columns="4" style="width:100%;">

        <f:facet name="header">
            Endereco
        </f:facet>

        <h:outputLabel for="cep" value="CEP:" />
        <p:inputMask mask="99.999-999"  value="#{pessoaMB.endereco.cep}" id="cep" >
            <f:ajax event="blur"  render="cidade bairro logradouro numero uf"  execute="cep"
                    listener="${pessoaMB.consultarEndereco()}"/>
        </p:inputMask>

        <h:outputLabel for="cidade" value="Cidade:" /> 
        <p:inputText value="${pessoaMB.endereco.cidade}" id="cidade" style="width:300px;"/>

        <h:outputLabel for="bairro" value="Bairro:" /> 
        <p:inputText value="${pessoaMB.endereco.bairro}" id="bairro"/>

        <h:outputLabel for="logradouro" value="Logradouro:" />
        <p:inputText value="#{pessoaMB.endereco.rua}" id="logradouro" style="width:400px;"/>

        <h:outputLabel for="uf" value="UF:" />
        <p:inputText value="#{pessoaMB.endereco.uf}" id="uf" style="width:90px;" readonly="false">
        </p:inputText>

        <h:outputLabel for="numero" value="Complemento:" /> 
        <p:inputText value="${pessoaMB.endereco.num}" id="numero" style="width:400px;"/>

        <f:facet name="footer">
            <center>
                Endereco                
            </center>            
        </f:facet>

    </p:panelGrid>
</html>
